﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace GetComics.Silverlight
{
    public class Rotator : IRotateable
    {
        /// <summary>
        /// Реализация интерфейса Rotatable
        /// </summary>
        /// <param name="rad"></param>
        /// <param name="element"></param>
        public void Rotate(double rad, FrameworkElement element)
        {
            RotateTransform rtTrans = ((TransformGroup)element.RenderTransform).GetTransform<RotateTransform>();
            rtTrans.CenterX = element.Width / 2;
            rtTrans.CenterY = element.Height / 2;
            rtTrans.Angle += 180 * rad / Math.PI;
        }
    }
}
